[#517] USD price tracking for PLOT token#526
Conversation
- Create lib/usd-price.ts with fallback chain: Mint Club SDK → GeckoTerminal → CoinGecko - 2-minute in-memory cache with in-flight request coalescing - Create /api/tokens/plot-price API route (2-min ISR + CDN cache) - Create usePlotUsdPrice client hook - Create UsdPriceTag component for server-rendered pages - Display USD values on: - Story cards (price + TVL with USD in parentheses) - Story page header (token price with USD) - Profile portfolio (total value + per-token values with USD) - Bump version to 0.1.5 Fixes #517 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
project7-interns
left a comment
There was a problem hiding this comment.
REQUEST CHANGES — one finding:
Duplicated USD formatting logic (4 copies)
The same formatting function is duplicated in 4 places:
lib/usd-price.ts:formatUsdValue(exported but never imported by any component)src/components/UsdPriceTag.tsx(inline formatting, lines 13-18)src/components/StoryCardStats.tsx:formatUsd(lines 20-25)src/app/profile/[address]/page.tsx:formatPortfolioUsd(lines 20-25)
All four are identical logic. The components should import formatUsdValue from lib/usd-price.ts instead of duplicating it. The function is pure and safe for client-side import.
Otherwise the architecture is solid — fallback chain with timeouts, request coalescing, ISR + CDN caching, graceful degradation.
…b/usd-price.ts Remove duplicated formatUsd/formatPortfolioUsd/inline formatting from StoryCardStats, UsdPriceTag, and profile page. All now import formatUsdValue. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
Re-reviewed — all USD formatting now uses the single formatUsdValue from lib/usd-price.ts. Duplicates removed from StoryCardStats, UsdPriceTag, and profile page. APPROVE.
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: REQUEST CHANGES
Summary
The USD pricing UI wiring is reasonable, but the new server-side price fetcher is hardcoded to Base mainnet sources even though this repo defaults to the Base Sepolia / PL_TEST environment.
Findings
- [high] The new PLOT USD fetcher is not chain-aware, so the feature returns
nullin the repo's default testnet setup and the new USD values never appear.- File:
lib/usd-price.ts:57 - Suggestion: make the fallback chain respect
IS_TESTNET/ current chain, or provide a testnet-compatible fallback forPL_TESTinstead of always querying Base mainnet endpoints.
- File:
Decision
Requesting changes because lib/contracts/constants.ts defaults NEXT_PUBLIC_CHAIN_ID to 84532 (Base Sepolia), but lib/usd-price.ts hardcodes Mint Club network("base"), GeckoTerminal networks/base, and CoinGecko token_price/base. In the current default environment, those sources do not resolve the testnet PL_TEST token, so /api/tokens/plot-price falls through to null and all of the new USD displays stay hidden.
Testnet tokens have no real USD value; return null immediately on IS_TESTNET. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Summary
Re-reviewed after operator clarification that current feature work targets mainnet only. Under that scope, the USD pricing fallback chain and derived USD displays are aligned with issue #517's intended production behavior.
Findings
- None.
Decision
Approving because the remaining blocker was based on stale testnet context. With operator-confirmed mainnet scope, the current head's PLOT USD pricing path, caching, API route, and UI displays are acceptable.
Summary
lib/usd-price.ts— server-side PLOT USD price with fallback chain: Mint Club SDK → GeckoTerminal → CoinGecko/api/tokens/plot-priceAPI route (ISR + CDN caching)usePlotUsdPriceclient hook andUsdPriceTagcomponentuseTokenInfohook0.1.5Architecture
token_price_in_PLOT × PLOT_USDlib/usd-price.tsfallback chain patternTest plan
/api/tokens/plot-pricereturns{ price: number, timestamp: number }Fixes #517
🤖 Generated with Claude Code